package it.win4buy.presentations
{
    import flash.events.IEventDispatcher;

    import it.win4buy.events.AlertComponentEvent;
    import it.win4buy.events.NavigationEvent;
    import it.win4buy.events.PlayEvent;
    import it.win4buy.utility.ApplicationConstants;

    /**
     *
     *	autore:
     *  pierangelo.mancusi@gmail.com
     *
     */

    public class AlertComponentPM
    {
        [Dispatcher]
        public var dispatcher:IEventDispatcher;

        [Bindable]
        /**
         *Message Showed in the middle.
         * @return
         *
         */
        public var message:String="";

        [Bindable]
        /**
         *Alert Title
         * @return
         *
         */
        public var title:String="";

        [Bindable]

        /**
         *Set the visibility of the Confirm Button
         * @return
         *
         */
        public var btConfirmVisible:Boolean;

        [Bindable]
        /**
         *Set the visibility of the Cancel Button
         * @return
         *
         */
        public var btCancelVisible:Boolean;

        //-------------------------------------------
        //
        // Constructor
        //
        //-------------------------------------------

        public function AlertComponentPM()
        {
        }

        //-------------------------------------------
        //
        // Mediator Handlers
        //
        //-------------------------------------------

        [EventHandler(event="AlertComponentEvent.LOADING", priority="990")]
        [EventHandler(event="AlertComponentEvent.INITIALIZING", priority="990")]
        /**
         *
         * Used <b>ONLY</b> at Application's STARTUP.
         *
         */
        public function setMessage(event:AlertComponentEvent):void
        {
            switch (event.type)
            {
                case AlertComponentEvent.LOADING:
                    break;
                case AlertComponentEvent.INITIALIZING:

                    btCancelVisible=false;
                    btConfirmVisible=false;
                    title="info";
                    message=event.message;

                    break;
                case AlertComponentEvent.RETRIEVE_USERDATA:
                    break;
                case AlertComponentEvent.RETRIEVE_PLACEHOLDER_LIST:
                    break;

            }

        }

        [EventHandler(event="PlayEvent.ALERT_REFRESH", priority="990")]
        public function refreshAlert(event:PlayEvent):void
        {

            switch (event.type)
            {
                case PlayEvent.ALERT_REFRESH:

                    break;

            }

        }

        //-------------------------------------------
        //
        // Public Handlers
        //
        //-------------------------------------------

        public function gotoMainState():void
        {
            dispatcher.dispatchEvent(new NavigationEvent(NavigationEvent.VIEW_PLACEHOLDER_MAIN, null, true));
        }

        public function deRegistration():void
        {

        }



    }
}